package com.xzzz.irda.guardcat.core.metric.app;

import cn.hutool.core.util.ClassLoaderUtil;
import com.xzzz.common.base.enums.BackendServiceEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.HashSet;
import java.util.Set;

/**
 * 获取之间的调用关系
 *
 * @author xzzz
 */
@Slf4j
@Deprecated
public class DubboRelationUtil {

    public static Set<String> getRelation() {
        Set<String> relation = new HashSet<>();
        for (BackendServiceEnum app : BackendServiceEnum.values()) {
            try {
                if (ClassLoaderUtil.isPresent(app.getRpcClazz())) {
                    relation.add(app.getName());
                }
            } catch (Exception e) {
                log.warn("检查关系错误:{}", e.getMessage());
            }
        }
        return relation;
    }
}
